<template>
    <h2 style="text-align: :center;">注册</h2>
<table>
    <tr>
        <td>手机号 <input type="text" v-model="info.username"></td>
        
    </tr>
    <tr>
        <td>密码 <input type="password" v-model="info.userpwd"></td>
       
    </tr>
    <tr>
        <td>确认密码密码 <input type="password" v-model="info.userpwd2"></td>
       
    </tr>
    <tr>
       
        <td  colspan="2">
            <button @click="login">点击</button>
        </td>
    </tr>
</table>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import {useRouter} from 'vue-router'
const router=useRouter()
const info=ref({
    username:"",
    userpwd:"",
    userpwd2:""
})
const login=()=>{
    if(info.value.username==""){
        alert("请输入账户")
        return;
    }
    if(info.value.username.length!=11 ){
        alert("长度只能是11位")
        return;
    }
    if(info.value.userpwd!= info.value.userpwd2){
        alert("两个信息必须一致")
        return;
    }
    if(info.value.username=="13512349876" && info.value.userpwd=="123456"){
        alert("登录成功")
        router.push=
        {
            name:"Login",
            params:{
                username:info.value.username,
                userpwd:info.value.userpwd
            }
        }
        alert("账户"+info.value.username+"密码"+info.value.userpwd)
      
    }else{
        alert("账户密码错误")
    }
   
}
</script>